package domd7;
class Dog implements Cloneable{
    public String name="旺财";

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class person implements Cloneable{
    public int age;
    public String name;
  public Dog dog=new Dog();
    public person(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
       // return super.clone();
        person tmp=(person) super.clone();
        tmp.dog=(Dog) this.dog.clone();
        return tmp;
    }
    @Override
    public String toString() {
        return "person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}


